package com.paas.service.modules.sso.cas.service.resolver;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jasig.services.persondir.IPersonAttributes;
import org.jasig.services.persondir.support.AttributeNamedPersonImpl;
import org.jasig.services.persondir.support.StubPersonAttributeDao;
import org.springframework.beans.factory.annotation.Autowired;

//import com.paas.service.modules.sso.cas.service.service.AccountService;

/**
 * 
 * @ClassName: UserStubPersonAttributeDao 
 * @Desc（描述这个类的做什么的）: 
 * 		扩展获得的用户信息
 * 		在java中可以通过下面的方式获取
		
		AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
		
		Map attributes = principal.getAttributes();
		
		String xxx=attributes .get("xxx");
 * @date: 2015年10月30日 下午1:54:36
 * @author Administrator
 * @version
 */
public class UserStubPersonAttributeDao extends StubPersonAttributeDao {

//	@Autowired
//	private AccountService accountService;
	/**
	 * 
	* @Title: getPerson
	* @Description: 
	*		获取登录后的用户信息
	*
	* @param uid
	* @return
	* @see org.jasig.services.persondir.support.StubPersonAttributeDao#getPerson(java.lang.String)
	 */
	@Override
	public IPersonAttributes getPerson(String uid){
		if (uid == null) {
			throw new IllegalArgumentException("用户主键不能为空！");
		}
		/* 这段是构造的，实际应用中应该从数据库中查询出来*/
		Map<String, List<Object>> attributes = new HashMap<String, List<Object>>();
		attributes.put("uid", Collections.singletonList((Object) uid));
		attributes.put("myinfo",Collections.singletonList((Object) "你好"));
		/* 101 */ return new AttributeNamedPersonImpl(attributes);
		/*     */ 
	}
}
